const path = require('path')
const webpack = require('webpack')

function resolve(dir) {
  return path.join(__dirname, dir)
}

module.exports = {
    publicPath: './',
    assetsDir: 'static',
    productionSourceMap: false,
    devServer: {
        proxy: {
            '/cpi':{
                target:'http://192.168.0.117',
                changeOrigin:true,
                pathRewrite:{
                    '^/cpi':''
                },
                logLevel: 'debug',
                onProxyReq: (proxyReq, req) => {
                    // http请求
                    console.log('[HPM] %s %s %s %s', req.method, req.originalUrl, '->', req.url);
                },
                onProxyReqWs(proxyReq, req, socket, options, head) {
                    // websocket请求（单个TCP连接上进行全双工通信的协议）
                    console.log('[HPM] %s %s %s %s', req.method, '-', req.url);
                }
            },
            '/media':{
                target:'https://ugoo.ugoolink.com/media',
                changeOrigin:true,
                pathRewrite:{
                    '^/media':''
                }
            }
        }
    },
    transpileDependencies: ['ml-matrix'],
    // transpileDependencies: [/node_modules/],
    configureWebpack: {
        devtool:"source map",
        watchOptions: {
            ignored: /node_modules/
            // ignored: ['**/node_modules']
        }
        // externals: {
        //   "echarts": "echarts"
        // },
        // module: {
        //   rules: [
        //     {
        //         test: /\.js$/,
        //         loader: 'babel-loader',
        //         include: [resolve('src'), resolve('test')],
        //         include: [
        //             resolve('src'),
        //             resolve('test'),
        //             resolve('node_modules/vue-echarts'),
        //             resolve('node_modules/resize-detector')
        //         ]
        //     }
        //   ]
        // }
    }
}

  